---
title: Document.Compare Method (Word)
keywords: vbawd10.chm158007781
f1_keywords:
- vbawd10.chm158007781
ms.prod: word
api_name:
- Word.Document.Compare
ms.assetid: 2715f719-d141-c60c-8956-64aa3a58e268
ms.date: 06/08/2017
---


# Document.Compare Method (Word)

Displays revision marks that indicate where the specified document differs from another document.


## Syntax

 _expression_ . **Compare**( **_Name_** , **_AuthorName_** , **_CompareTarget_** , **_DetectFormatChanges_** , **_IgnoreAllComparisonWarnings_** , **_AddToRecentFiles_** , **_RemovePersonalInformation_** , **_RemoveDateAndTime_** )

 _expression_ Required. A variable that represents a **[Document](document-object-word.md)** object.


### Parameters



|**Name**|**Required/Optional**|**Data Type**|**Description**|
|:-----|:-----|:-----|:-----|
| _Name_|Required| **String**|The name of the document with which the specified document is compared.|
| _AuthorName_|Optional| **Variant**|The reviewer name associated with the differences generated by the comparison. If unspecified, the value defaults to the author name of the revised document or the string "Comparison" if no author information is present.|
| _CompareTarget_|Optional| **Variant**|The target document for the comparison. Can be any  **WdCompareTarget** constant.|
| _DetectFormatChanges_|Optional| **Boolean**| **True** (default) for the comparison to include detection of format changes.|
| _IgnoreAllComparisonWarnings_|Optional| **Variant**| **True** compares the documents without notifying a user of problems. The default value is **False** .|
| _AddToRecentFiles_|Optional| **Variant**| **True** adds the document to the list of recently used files on the **File** menu.|
| _RemovePersonalInformation_|Optional| **Boolean**| **True** removes all user information from comments, revisions, and the properties dialog box in the returned **Document** object . The default value is **False** .|
| _RemoveDateAndTime_|Optional| **Boolean**| **True** removes date and time stamp information from tracked changes in the returned **Document** object. The default value is **False** .|

## Example

This example compares the active document with the document named "FirstRev.doc" in the Draft folder and places the comparison differences in a new document.


```vb
Sub CompareDocument() 
 ActiveDocument.Compare Name:="C:\Draft\FirstRev.doc", _ 
 CompareTarget:=wdCompareTargetNew 
End Sub
```


## See also


#### Concepts


[Document Object](document-object-word.md)

